import React, { Suspense, lazy } from "react";
import { BrowserRouter as Router, Routes, Route } from "react-router-dom";

// 懒加载组件
const Home = lazy(() => import("./pages/admin/Home"));
const Obtain = lazy(() => import("./pages/Obtain/Obtain"));
const Security = lazy(() => import("./pages/Security/Security"));
const App: React.FC = () => {
  return (
    <Router>
      <Suspense
        fallback={
          <h2
            style={{
              width: "100%",
              height: "100%",
              textAlign: "center",
              lineHeight: "100vh",
              color: "white",
            }}
          >
            Loading...
          </h2>
        }
      >
        <Routes>
          <Route path="/" element={<Home></Home>}></Route>
          <Route path="/Obtain" element={<Obtain></Obtain>}></Route>
          <Route path="/Security" element={<Security></Security>}></Route>
        </Routes>
      </Suspense>
    </Router>
  );
};

export default App;
// 2
